package Day09;

import Day05.Pet;

import javax.swing.*;
import java.util.InputMismatchException;
import java.util.Scanner;

public class Texxt4{
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int result = devided();
        System.out.println(result);

    }

    public static int devided(){
        try {
            int number1 = getNumber();
            int number2 = getNumber();
            return number1 / number2;
        } catch(InputMismatchException e){
            System.out.println("请输入数字");
            return -1;
        } catch(ArithmeticException e){
            System.out.println("除法运算中除数不能为零");
            return -2;
        }

    }

    public static int getNumber() throws InputMismatchException{
        System.out.println("请输入一个数字");
        int number = sc.nextInt();
        return number;
    }
}